# Maintainer: Sodface <sod@sodface.com>
pkgname=kissfft
pkgver=131.1.0
pkgrel=2
pkgdesc="Fast Fourier Transform (FFT) library that tries to Keep it Simple, Stupid"
url="https://github.com/mborgerding/kissfft"
arch="all"
license="BSD-3-Clause"
depends_dev="$pkgname=$pkgver-r$pkgrel"
makedepends="
	cmake
	fftw-dev
	libpng-dev
	samurai
	"
checkdepends="
	py3-numpy
	python3
	"
subpackages="
	$pkgname-dev
	$pkgname-libs
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/mborgerding/kissfft/archive/refs/tags/$pkgver.tar.gz
	mpil.patch
	"

build() {
	CFLAGS="$CFLAGS -O2 -flto=auto" \
	CXXFLAGS="$CXXFLAGS -O2 -flto=auto" \
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DKISSFFT_TEST="$(want_check && echo ON || echo OFF)"
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure -j${JOBS:-2}
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
bd715868ce0e93a291a0592fb1f8b960e832fc64efe863755e52b67d5addff9bcb444a1bf2570d1914c52b41dad1023d0d86400f5ea30c9fb84cd6b4f7210708  kissfft-131.1.0.tar.gz
fa1311363ba71bf3d091836d64fffd556e3221c2c7131de8fb640cfd86607e35db88c9b93b9f7c175344ab6c3629e1b571936dd986750199c27ba229d43032b0  mpil.patch
"
